<%--
	User: dizem@126.com
	Time: 11-6-23 上午10:52
--%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv=content-type content="text/html; charset=UTF-8"/>
  <title>今日团购</title>
  <link rel="stylesheet" href="/css/index.css" type="text/css" media="screen" charset="utf-8"/>
  <script type="text/javascript" src="../js/jquery-1.6.js"></script>
  <script type="text/javascript" src="../js/jquery-ui-1.8.14.custom.min.js"></script>
  <script type="text/javascript" src="../js/common.js"></script>
  <script type="text/javascript" src="../js/order.js"></script>
  <script type="text/javascript">

    function openOrderDialogByArgs(id, title, price) {
      $("#itemId").val(id);
      $("#order-title").text(title);
      $(".order-price").text(price);
      var username = "<%=session.getAttribute("SESSION_USERNAME")%>";
      if (username == null || username == "" || username == "null") {
        confirm("下订单必须先登录<br/><br/>是否登录？", "提示", function() {
          $("#dialog-login").dialog("open");
        });
      } else {
        $("#dialog-order").dialog("open");
      }
      return false;
    }

    $(function() {
      var $sidebar = $("#sidebar"), $window = $(window),
          offset = $sidebar.offset(), topPadding = 10;
      $window.scroll(function() {
        if ($window.scrollTop() > offset.top) {
          $sidebar.stop().animate({
            marginTop: $window.scrollTop() - offset.top + topPadding
          });

        } else {
          $sidebar.stop().animate({
            marginTop: 0
          });
        }
      });
    });

  </script>
</head>
<body>

<jsp:include page="../common/header.jsp"/>
<s:action name="listCurrentItem" namespace="/admin" id="listItem"/>

<div id="bdw" class="bdw">
  <div id="bd" class="cf">
    <div id="sysmsg-guide">
      <div class="link"><a href="#"></a></div>
    </div>
    <div id="deal-default">
      <div id="content">
        <s:iterator id="item" value="#listItem.items">
          <div id="deal-intro" class="cf">
            <div class="no">${item.id}</div>
            <h1><a class="deal-today-link" href="item.action?id=${item.id}">今日团购：${item.title}</a></h1>

            <div class="main">
              <div class="deal-buy">
                <div class="deal-price-tag">
                </div>
                <p class="deal-price">
                  <strong>${item.groupPrice}</strong>
                  <span>
                    <a href="#"
                       onclick="return openOrderDialogByArgs($(this).children().eq(0).val(),$(this).children().eq(1).val(),$(this).children().eq(2).val());">
                      <input type="hidden" value="${item.id}"/>
                      <input type="hidden" value="${item.title}"/>
                      <input type="hidden" value="${item.groupPrice}"/>
                      <img src="../image/button-d.gif" alt=""/>
                    </a>
                  </span>
                </p>
              </div>
              <table class="deal-discount">
                <tr>
                  <th>原价</th>
                  <th>折扣</th>
                  <th>节省</th>
                </tr>
                <tr>
                  <td>
                    <del>¥${item.marketPrice}</del>
                  </td>
                  <td>
                    <fmt:formatNumber type="number" value="${item.groupPrice/item.marketPrice*10}"
                                      maxFractionDigits="0"/>折
                  </td>
                  <td>¥${item.marketPrice-item.groupPrice}</td>
                </tr>
              </table>
              <div class="deal-box deal-timeleft deal-on" id="deal-timeleft-1">
                <c:choose>
                  <c:when test="${item.timeState} == /^团购/">
                    <h3>${item.timeState}</h3>
                  </c:when>
                  <c:otherwise>
                    <h3>剩余时间</h3>

                    <div>
                      <ul id="counter-1">
                        <p>${item.timeState}</p>
                      </ul>
                    </div>
                  </c:otherwise>
                </c:choose>
              </div>
              <div class="deal-box deal-status" id="deal-status">
                <p class="deal-buy-tip-top">
                  <strong>${item.currentCount}</strong> 人已购买
                </p>

                <div class="progress-pointer" style="padding-left: 0px;">
                  <span></span>
                </div>
                <div class="progress-bar">
                  <div class="progress-left" style="width: 0;">
                  </div>
                  <div class="progress-right" style="width:0;">
                  </div>
                </div>
                <div class="cf">
                  <div class="min">${item.minCount}</div>
                  <div class="max">${item.maxCount}</div>
                </div>
                <p class="deal-buy-tip-btm">
                  还差<strong>${item.minCount - item.currentCount}</strong> 人到达最低团购人数
                </p>
              </div>
            </div>

            <div class="side">
              <div class="deal-buy-cover-img" id="team_images">
                <a href="/item.action?id=${item.id}">
                  <img class="item_img" src="/getImage.action?id=${item.image1.id}" style="max-height:100%;width:auto" border="0"/>
                </a>
              </div>
              <div class="digest">
                <img src="../image/bg-deal00.gif" alt="" style="margin-left:280px">
                <br>

                <h3>${item.feature}</h3>
              </div>
            </div>
          </div>
          <br>
          <br>
        </s:iterator>
        <br/>
      </div>
      <div id="sidebar">
        <jsp:include page="../common/sidebar/merchant_bar.jsp"/>
        <jsp:include page="../common/sidebar/faq_bar.jsp"/>
        <jsp:include page="../common/sidebar/link_bar.jsp"/>
      </div>
    </div>
  </div>
</div>
<jsp:include page="../common/footer.jsp"/>
</body>
</html>
<jsp:include page="../common/dialog/order_dialog.jsp"/>